<%-- 
    Document   : category
    Created on : Mar 29, 2014, 5:54:15 PM
    Author     : windows 7 Ult
--%>
<%@ include file="header.jsp" %>
    <!-- start top_bg -->
    <div class="top_bg">
        <div class="wrap">
            <div class="main_top">
                <h2 class="style">our products</h2>
            </div>
        </div>
    </div>
    <!-- start main -->
    <div class="main_bg">
        <div class="wrap">
            <div class="main">
                
                <sql:query dataSource="${conn}" var="categoryResult">
                    SELECT * from Category where id = ? ;
                    <sql:param value="${param.catId}"  />
                </sql:query>
                <c:forEach var="catRow" items="${categoryResult.rows}">    
                    <div class="top_main">
                        <h2><c:out value="${catRow.name}"/></h2>
                        <!-- <a href="#">show all</a> -->
                        <div class="clear"></div>
                    </div>     
                    <!-- start grids_of_3 -->
                    <div class="grids_of_3">
                        <sql:query dataSource="${conn}" var="result">
                            SELECT * from Product where categoryId = ? ;
                            <sql:param value="${catRow.id}" />
                        </sql:query>
                        <c:set value="0" var="count" />    
                        <c:forEach var="productRow" items="${result.rows}">
                            <div class="grid1_of_3 <c:if test="${count%3 == 0}" >firstChild</c:if> ">
                                   <a href="singleproduct.jsp?prodId=${productRow.id}">
                                        <!-- <img src="data:image/jpg;base64,<c:out value="${productRow.image}"/>" /> -->
                                       <img src="DisplayImage?id=${productRow.id}" width="186" height="210" />
                                        <h3><c:out value="${productRow.name}"/></h3>
                                        <span class="price"><c:out value="${productRow.price}"/></span>
                                        <!-- <span class="price1 bg">on sale</span> -->
                                    </a>
                                    <div class="clear"></div>
                                </div>     
                                <c:set value="${count+1}" var="count" /> 
                        </c:forEach>
                        <div class="clear"></div>
                    </div>    
                </c:forEach>              
                    
             </div>
            </div>
        </div>
        <%@ include file="footer.jsp" %>
